package org.ui;

import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.List;

import javax.swing.Box;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import org.ui.UITemplate.JComponentTemplate;

public class WallpaperSelector  extends UITemplate.JDialogTemplate{
    private JPanel mContentPanel;
    public WallpaperSelector(JFrame father) {
       super(father,true);
       this.setLocationRelativeTo(father);
       this.setVisible(true);
       this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
       
    }
    @Override
    protected void initLayout() {
        // TODO Auto-generated method stub
        
    }
    @Override
    protected void initUI() {
        this.setSize(600, 600);
        mContentPanel=new WallpaperPanel();
        JScrollPane jsp = new JScrollPane();
        jsp.getVerticalScrollBar().setUnitIncrement(20);
        jsp.setViewportView(mContentPanel);
        this.setContentPane(jsp);
        
    }
      
    class  WallpaperPanel extends UITemplate.JPanelTemplate{
        private  Box vBox;
        private List<PapaerItem> mPapers;
        public WallpaperPanel() {
            mPapers=new ArrayList<PapaerItem>();
        }
        @Override
        protected void initLayout() {
            this.setLayout(new FlowLayout(FlowLayout.LEFT));
              
        }
        @Override
        protected void initUI() {
          vBox=Box.createVerticalBox();
          this.add(vBox);
          vBox.add(new PapaerItem());
          vBox.add(new PapaerItem());
          vBox.add(new PapaerItem());             
        }
        class  PapaerItem extends JComponentTemplate{
           private PaperFrameWithButton mPaperFrameWithButton;
           private ThumbnailFrameWithButton mThumbnailFrameWithButton;
           private Box hBox;
            @Override
            protected void initLayout() {
                this.setLayout(new FlowLayout(FlowLayout.LEFT));
            }
            @Override
            protected void initUI() {              
               hBox=Box.createHorizontalBox();
               mPaperFrameWithButton=new PaperFrameWithButton();
               mThumbnailFrameWithButton=new ThumbnailFrameWithButton();
               this.add(hBox);
               hBox.add(mPaperFrameWithButton);
               hBox.add(mThumbnailFrameWithButton);
               this.setVisible(true);
            }
        }
    }
}
